perm filename INDENT.DCS[UP,DOC]1 blob
sn#002771 filedate 1972-10-06 generic text, type T, neo UTF8
INDENT -- SAIL SOURCE PROGRAM INDENTER
INDENT reads any SAIL program file, producing a file
containing the same program in a standard format.
Dan Swinehart
9 January, 1972
1
SECTION I
USING INDENT
I-A. ____________ Capabilities
INDENT produces a properly indented SAIL program, if your notion of
proper indentation coincides with mine. Otherwise it produces a SAIL
program indented in a standard fashion according to a set of
hopelessly inadequate rules.
Leading spaces and tabs are removed from all input lines. Then new
lines are formed, and indentation rules applied, when:
1. BEGINs and ENDs are seen (indentation changes here)
2. Any input line becomes too long
3. A new line appears in the input file
A "Block Indentation" parameter exists which determines the number of
extra spaces added to each line after a (type 1) BEGIN line until the
matching END is seen.
A "Continuation" line is a type 2 line, or any non-type 1 line, when
the preceding line does not end in ";", ",", etc. Continuation lines
are indented by an additional amount equal to the "Continuation
Indentation" parameter.
Special rules are applied to Comment lines, and to certain other
constructs.
I-B. _______ ______ Running Indent
Type "R INDENT" to run the program. An asterisk will appear. The
command format is the standard one for processors which are not run
via COMPILE, DEBUG, etc., to wit:
<output file>←<input file><switch list>. Each switch is preceded by
a slash ("/"), or a number of switches may be enclosed in
parentheses. A switch is (sometimes) a number, then (always) a
letter. Switches are used to set the above parameters, as well as
some others.
The default output file extension (if none is specified) is "SA1".
The default input file extension is "SAI". If something goes wrong,
see me.
USING INDENT 2
I-C. ________ Switches
Let `d' be a decimal number, `o' an octal number.
SWITCH DEFAULT MEANING
dI 3 This is the Block-Indentation parameter. The text of
each block and compound statement will be indented
`d' spaces from the next outer block.
dO 1 The Continuation-Indentation parameter.
dB 0 The left margin. You can start at some column other
than 1 so that files can later be merged.
dL 75 Max line length before a continuation line is forced.
dD 0 Depth -- no indentation will occur at all until BEGIN
nesting reaches this depth. Thus, if your program
has many initial outer blocks before the important
stuff begins, you can inhibit unwanted indentation.
oC 0 The octal code for a character to serve as an "As is"
character. No text between two occurrences of this
character will be subject to indentation. It will
be passed to the output file "as is". This
character should be "DEFINE"d as some harmless
thing (like space) so that SAIL won't complain.
T Output will be typed on your console. Omit the
"output file" spec in the command string.
3
SECTION II
EXAMPLE
The command is: CHG←CHG(5B4I2O)
File CHG.SAI:
BEGIN "CHG"
INTEGER BRK,EOF,FLAG;STRING S;
DEFINE
INF="1",
OUTF="2",
TAB="1";
SETBREAK(1,"{}"&'177&'21,NULL,"IN");
COMMENT Get the input;
LOOKUP(INF,INCHWL,FLAG);
OUTSTR("OUTPUT FILE ");
"Get the Output"
ENTER(OUTF,INCHWL,FLAG);
WHILE TRUE DO BEGIN
OUT(OUTF,IF BRK="{" THEN "[" ELSE IF
BRK="}" THEN "]" ELSE IF
BRK='21 THEN '12 ELSE BRK)
END;
END "CHG";
EXAMPLE 4
File CHG.SA1:
BEGIN "CHG"
INTEGER BRK,EOF,FLAG;STRING S;
DEFINE
INF="1",
OUTF="2",
TAB="1";
SETBREAK(1,"{}"&'177&'21,NULL,"IN");
COMMENT Get the input;
LOOKUP(INF,INCHWL,FLAG);
OUTSTR("OUTPUT FILE ");
"Get the Output"
ENTER(OUTF,INCHWL,FLAG);
WHILE TRUE DO BEGIN
OUT(OUTF,IF BRK="{" THEN "[" ELSE IF
BRK="}" THEN "]" ELSE IF
BRK='21 THEN '12 ELSE BRK)
END;
END "CHG";